<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./jquery.js"></script>
    <style>
      .h1color {
        color: red;
      }
      .h1font {
        background: black;
      }
    </style>
  </head>
  <body>
    <div>
      <h1 class="">我是h1</h1>
      <h2>我是h2</h2>
      ni shi shei
    </div>
    <input type="text" name="zhangsan" zhangsan="lisi" />
    <input type="checkbox" name="zhangsan" zhangsan="lisi" id="box" checked />
    <button onclick="afterText()">点击</button>
  </body>
  <script>
    $(function () {
      //   var divText = $('div').text('<b>我要设置文本</b>')
      //   var divHtml = $('div').html('<b>我要设置文本</b>')
      //   console.log(divText)
      //   console.log(divHtml)
    })
    function fun() {
      console.log($('#box').attr('zhangsan'))
    }
    function afterText() {
      $('h1,h2').addClass(function (i, c) {
        return 'h1color h1font'
      })
    }
  </script>
</html>
